package cate.common.table.item;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cp.solution.util.str.Str;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@NoteClass("装备宝箱")
public class EquipBoxRow extends ERow {

    @NoteField("道具ID")
    public int itemId;

    @NoteField("类型")
    public byte type;

    @NoteField("品质")
    public byte quality;

    @NoteField("精英装备")
    public byte elite;

    @NoteField("部位")
    public byte pos;

    @NoteField("限定阵营印记")
    private String randomCampMarkCode;

    @NoteField("自选阵营印记")
    private String pickCampMarkCode;

    @NoteField("附加配置")
    public String exConfig;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("道具ID",0);
        this.itemId = xrw.getInteger("道具ID",0);
        this.type = xrw.getByte("类型", (byte)0);
        this.quality = xrw.getByte("品质",(byte)0);
        this.elite = xrw.getByte("精英装备",(byte)0);
        this.pos = xrw.getByte("部位",(byte)0);
        this.randomCampMarkCode = xrw.getString("限定阵营印记");
        this.pickCampMarkCode = xrw.getString("自选阵营印记");
        this.exConfig = xrw.getString("附加配置");
    }

    public List<Byte> randomCampMarks;

    public List<Byte> pickCampMarks;

    @Override
    public void decode() {
        if(StringUtils.isNotBlank(randomCampMarkCode)){
            randomCampMarks = Str.strArr2byteList(randomCampMarkCode.split("#"));
        }

        if(StringUtils.isNotBlank(pickCampMarkCode)){
            pickCampMarks = Str.strArr2byteList(pickCampMarkCode.split("#"));
        }
    }
}
